#include "ResourceBase.h"

const RateTable ResourceBase::m_rateTable[RATE_TABLE_SIZE] = {
    RateTable(80000.0f , 0.45f, 13505.0f, true),
    RateTable(55000.0f , 0.35f,  5505.0f, true),
    RateTable(35000.0f , 0.30f,  2755.0f, true),
    RateTable(9000.0f  , 0.25f,  1005.0f, true),
    RateTable(4500.0f  , 0.20f,   555.0f, true),
    RateTable(1500.0f  , 0.10f,   105.0f, true),
    RateTable(0.0f     , 0.03f,     0.0f, true)
};

const float ResourceBase::m_startMoney = 3500.0f;

ResourceBase::ResourceBase()
{
}

float ResourceBase::getStartMoney()
{
    return m_startMoney;
}

RateTable ResourceBase::calculateRate(float money){
    for (int i = 0; i < RATE_TABLE_SIZE; ++i) {
        if (money > m_rateTable[i].minMoney) {
            return m_rateTable[i];
        }
    }
    return RateTable();
}
